#!/bin/sh
# This regression test is a part of SIPp.
# The variables screen names the subtract and test actions.
. "`dirname "$0"`/../functions"; init

out=`mktemp`
"`get_sipp`" -nostdin -sf uac.xml -i 127.0.0.1 -p 5070 -cp 8890 \
    127.0.0.1:5099 -m 1 >"$out" 2>&1 &
sipp=$!
sleep 1
# Key 4: the variables screen, which the closing screens start with.
perl -e 'use IO::Socket::INET;
    IO::Socket::INET->new(PeerAddr => "127.0.0.1:8890", Proto => "udp")->send("4")'
wait $sipp
screen=`cat "$out"`
rm -f "$out"

if ! echo "$screen" | grep -q 'subtract varId\[n\] 1.000000'; then
    fail "no subtract action"
elif ! echo "$screen" | grep -q 'test varId\[two\] varInId\[n\] == 2.000000'; then
    fail "no test action"
else
    ok
fi
